<template>
	<view>
		<view class="tp">
			<image src="/static/head_icon.png" mode="aspectFill"></image>
		</view>
		<uni-forms class="dl" ref="form" :rules="{}">
			<uni-forms-item label="用户名" name="">
				<uni-easyinput v-model="userInfo.username" placeholder="请输入用户名"
				 @iconClick="iconClick"
				  prefixIcon="person-filled" />
			</uni-forms-item>
			<uni-forms-item label="密码" name="">
				<uni-easyinput v-model="userInfo.password" placeholder="请输入密码" prefixIcon="locked" 
				type="password"/>
			</uni-forms-item>
			<uni-forms-item class="an" label="" name="">
				<button type="primary" :plain="true" :loading="false" @click="login">登录</button>
			</uni-forms-item>
		</uni-forms>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				userInfo:{
					username:'',
					password:''
				}
			}
		},
		methods:{
			login(e){
				if(this.userInfo.username==='tom' && this.userInfo.password==='123'){
					uni.showToast({
						title:'欢迎'+this.userInfo.username,
						duration:10000
					});
				}else{
					uni.showToast({
						title:'用户名或密码错误',
						duration:10000
					})
				}
			},
			iconClick(e){
				console.log(e);
			}
		}
	}
</script>

<style>
	.tp{
		width: 100rpx;
		height: 100rpx;
		border-radius: 50%;
		overflow: hidden;
		margin-top: 10px;
		margin-left: 155px;
		
	}
	.dl{
		width: 80%;
		margin-top: 20px;
		margin-left: 25px;
	}
	.an{
		width: 80%;
		margin-left: 45px;
		background-color: aliceblue;
	}
</style>
